Component({
  data: {
    backgroundColor: 'white',
    borderColor: '#ccc',
    color: '#999',
    selectedColor: '#17f',
    list: [
      {
        pagePath: '/pages/tab-bar/tab1/tab1',
        text: '主页',
        iconPath: '/assets/images/ic_home.png',
        selectedIconPath: '/assets/images/ic_home_selected.png'
      },
      {
        pagePath: '/pages/tab-bar/tab2/tab2',
        text: '消息',
        iconPath: '/assets/images/ic_message.png',
        selectedIconPath: '/assets/images/ic_message_selected.png',
        msgCount: 7
      },
      {
        pagePath: '/pages/tab-bar/tab3/tab3',
        text: '联系我们',
        iconPath: '/assets/images/ic_contact_us.png',
        selectedIconPath: '/assets/images/ic_contact_us_selected.png'
      }
    ],
    selectedIndex: 0
  },

  methods: {
    onItemClick(event) {
      const dataset = event.currentTarget.dataset
      wx.switchTab({ url: dataset.pagePath })
      // 索引切换逻辑：/pages/tab-bar/tab1/tab1.js → onShow
      // this.setData({ selectedIndex: dataset.index })
    }
  }
})